package com.babycare.bbcareproduct.controller;

import com.babycare.common.utils.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class NacosConfController {

    @Value(value = "${students.name:null}")
    String name;
    @Value(value = "${students.age:0}")
    int age;

    @Value(value = "${username:null}")
    String username;

    @GetMapping("nacos/config")
    public R getNacosConfig() {
        return R.ok().put("name", name).put("age", age).put("username", username);
    }

}
